package ru.ifmo.rybakov.muclumon.analysis2;

import java.util.Collection;

public abstract class Cluster {
	public abstract Collection<?> getObjects();
	
	/**
	 * Merges current cluster with other and returns the result
	 * @param other Other cluster to merge with
	 * @return Merged cluster
	 */
	public abstract Cluster merge(Cluster other);

	@Override
	public String toString() {
		Collection<?> objects = getObjects();
		StringBuilder sb = new StringBuilder("{");
		int i = 0;
		for (Object o : objects) {
			sb.append(o.toString());
			i++;
			if (i < objects.size()) {
				sb.append(",");
			}
		}
		sb.append("}");
		return sb.toString();
	}
}
